- /* scfccosh.cpp by K.Tsuru */
- // function ID = 9109
- /*****************************************
- SComplex class
- It returns cosh(z).
- Let z = x+iy,
- cosh(z) = cosh(x)*cos(y)+i*sinh(x)sin(y).
- *****************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- #define UseCSBSccosh 1
-
- SComplex Ccosh(const SComplex& z)
- {
- #if UseCSBSccosh // 16.06 sec
- SDouble chx, shx, cy, sy, x(Re(z)), y(Im(z));
-
- Hyperbolic(x, chx, shx); // chx = cosh(x) shx = sinh(x)
- CosSinBS(y, cy, sy); // cy = cos(y), sy = sin(y);
-
- return SComplex(chx*cy, shx*sy);
- #else // 16.16 sec
- SDouble rr, ri, sh, s, c;
- sh = Sinh(z.Real());
- s = Sin(z.Imag());
-
- if( (s.PreferSpeed() == ON) && (s.NetRdxExp() > -2) ){
- c = Sqrt(1.0-s*s); // |s| is O(1.0).
- }else c = Cos(z.Imag()); // |s| is very small.
-
- rr = Sqrt(1.0+sh*sh)*c; // cosh(x)*cos(y)
- ri = sh*s; // sinh(x)*sin(y)
-
- return SComplex(rr, ri);
- #endif
- }
scfccosh.cpp : last modifiled at 2015/08/17 11:07:02(943 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:08 (Fri Oct 06 15:27:08 2017).